package logx

import (
	logx "go.opentelemetry.io/otel/log"
	"go.opentelemetry.io/otel/sdk/log"
	"go.opentelemetry.io/otel/sdk/resource"
)

type ProviderConfig struct {
	ExporterConfig            Config
	AttributeCountLimit       int `json:"attribute_count_limit" toml:"attribute_count_limit"`
	AttributeValueLengthLimit int `json:"attribute_value_length_limit" toml:"attribute_value_length_limit"`
}

func (c ProviderConfig) NewProvider(
	res *resource.Resource,
	processor log.Processor,
) logx.LoggerProvider {
	provider := log.NewLoggerProvider(
		log.WithResource(res),
		log.WithProcessor(processor),
		log.WithAttributeCountLimit(c.AttributeCountLimit),
		log.WithAttributeValueLengthLimit(c.AttributeValueLengthLimit),
	)

	return provider
}
